home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / misc / emu / ATUtilities.lha / ATUtilities / res.c < prev    next >
C/C++ Source or Header  |  2000-09-26  |  3KB  |  128 lines

  1. #include <exec/types.h>
  2. #include <libraries/dos.h>
  3. #include <intuition/intuition.h>
  4.  
  5. #define BIT7 (1<<7)
  6.  
  7. struct IntuitionBase *IntuitionBase;
  8. struct JanusBase     *JanusBase;
  9.  
  10. struct NewWindow nw=
  11. {
  12.  75,75,450,10,
  13.  0,1,
  14.  CLOSEWINDOW|RAWKEY,
  15.  WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG|ACTIVATE,
  16.  NULL,NULL,"ATUtilities Rescue - Version 4.0",
  17.  NULL,NULL,
  18.  100,10,640,20,
  19.  WBENCHSCREEN
  20. };
  21.  
  22.  
  23. VOID Sendung();
  24.  
  25.  
  26. UBYTE Table[256];
  27. ULONG JanusStart;
  28.  
  29.  
  30. /* Hauptprogramm */
  31. VOID main(argc,argv)
  32.  LONG   argc;
  33.  UBYTE *argv[];
  34. {
  35.  REGISTER BOOL                 ende;
  36.  REGISTER ULONG                Class;
  37.  REGISTER UWORD                Code;
  38.  register struct FileHandle   *fh;
  39.  register struct Window       *win;
  40.  register struct IntuiMessage *msg;
  41.  struct Screen                *scr;
  42.  
  43.  IntuitionBase=OpenLibrary("intuition.library",0L);
  44.  if(IntuitionBase!=NULL)
  45.   {
  46.    scr=OpenWorkBench();
  47.    nw.Height=scr->WBorTop+scr->Font->ta_YSize+1;
  48.    win=OpenWindow(&nw);
  49.    if(win!=NULL)
  50.     {
  51.      JanusBase=OpenLibrary("janus.library",0L);
  52.      if(JanusBase!=NULL)
  53.       {
  54.        fh=Open("AT:ATKeyboard-System/Rescue.codetable",MODE_OLDFILE);
  55.        if(fh!=NULL)
  56.         {
  57.          Read(fh,&Table,256);
  58.          JanusStart=GetJanusStart();
  59.          ende=FALSE;
  60.  
  61.          while(ende==FALSE)
  62.           {
  63.            WaitPort(win->UserPort);
  64.            msg=GetMsg(win->UserPort);
  65.            Class=msg->Class;
  66.            Code=msg->Code;
  67.            ReplyMsg(msg);
  68.            switch(Class)
  69.             {
  70.              case CLOSEWINDOW:
  71.                ende=TRUE;
  72.               break;
  73.              case RAWKEY:
  74.                if((Code==0x62)||(Code==(0x62+BIT7)))
  75.                 {
  76.                  Sendung(0xba);
  77.                  Delay(5);
  78.                  Sendung(0x3a);
  79.                 }
  80.                else
  81.                 {
  82.                  Sendung(Table[(UBYTE)Code]);
  83.                 }
  84.                Delay(3);
  85.               break;
  86.             }
  87.           }
  88.  
  89.          Close(fh);
  90.         }
  91.        else
  92.         {
  93.          SetWindowTitles(win,"Rescue - CodeTable-Datei fehlt!",-1L);
  94.          Delay(200);
  95.         }
  96.        CloseLibrary(JanusBase);
  97.       }
  98.      else
  99.       {
  100.        SetWindowTitles(win,"Rescue - Keine Janus-Library!",-1L);
  101.        Delay(200);
  102.       }
  103.      CloseWindow(win);
  104.     }
  105.    CloseLibrary(IntuitionBase);
  106.   }
  107. }
  108.  
  109. #asm
  110.    public _Sendung
  111. _Sendung:
  112.    movem.l a1-a2/d7,-(sp)
  113.    move.l 16(sp),d7
  114.    move.l _JanusStart,a1
  115.    move.l a1,a2
  116.    adda.l #516096,a1
  117.    moveq.l #0,d0
  118.    move.l _JanusBase,a6
  119.    move.w 114(a6),d0
  120.    add.l d0,a1
  121.    adda.l #524283,a2
  122.    move.b d7,(a1)
  123.    move.b #-1,(a2)
  124.    movem.l (sp)+,a1-a2/d7
  125.    rts
  126. #endasm
  127.  
  128.